package br.com.spam.pipeline.instruction;

import br.com.spam.pipeline.ConverterHelper;
import br.com.spam.pipeline.core.Processor;
import br.com.spam.pipeline.core.Register;

public abstract class ITypeInstruction extends Instruction
{
	private final Register _rs, _rt;
	private final int _immediate;

	public ITypeInstruction(String instruction, Processor processor)
	{
		super(instruction, processor);
		this._rs = this.processor.getRegister(ConverterHelper.stringToInt(instruction.substring(6,
				11)));
		this._rt = this.processor.getRegister(ConverterHelper.stringToInt(instruction.substring(11,
				16)));
		this._immediate = ConverterHelper.stringToInt(instruction.substring(16, 32));
	}

	protected Register rs()
	{
		return this._rs;
	}

	protected Register rt()
	{
		return this._rt;
	}

	protected int immediate()
	{
		return this._immediate;
	}
}
